<template>
    <div :style="{minHeight: h}" class="main">
        <header-1 class="d1">
            <template v-slot:center>
               <span class="center">
                    添加规则
               </span>
            </template>
            <template v-slot:right>
               <span class="right" @click="sure">
                    确定
               </span>
            </template>
        </header-1>
        <div class="show">
            <div class="show1">
                <span>赠送条件</span>
                <input class="show1_1" v-model="money" placeholder="请输入满多少金额从送赠品" />
            </div>
            <div class="show1">
                <span>赠品中文名称</span>
                <input class="show1_1" v-model="name" placeholder="如苹果" />
            </div>
            <div class="show1">
                <span>赠品英文名称</span>
                <input class="show1_1" v-model="usname" placeholder="Such as Apple" />
            </div>
            <div class="show1">
                <span>赠送数量</span>
                <input class="show1_1" v-model="num" placeholder="请输入赠品数量" />
            </div>
        </div>
    </div>
</template>
<script>
import header1 from '../../components/BS/header1View.vue'
import{mapMutations} from 'vuex'
export default {
    data(){
        return{
            h: '',
            money:'',
            name:'',
            usname:'',
            num:'',
        }
    },
    created(){
        this.h = window.innerHeight + 'px'
    },
    components:{
        header1,
    },
    methods:{
        ...mapMutations(['Bus/add','Bus/add1']),
       sure(){
        let index = this.$route.params.id
        let a = 
            {
                money:this.money,
                name: this.name,
                usname: this.usname,
                num: this.num
            }
        if(index == 1){
            this['Bus/add'](a)
        }
        if(index == 2){
            this['Bus/add1'](a)
        }
        this.$router.go(-1)
       }
    }
}
</script>
<style scoped> 
.main{
    background-color: #f5f5f5;
}
.show{
    width: 100%;
    height: 225px;
    background-color: #FFFFFF;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    margin-bottom: 20px;

}
.show1{
    width: 90%;
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}
.show1_1{
    width: 240px;
    height: 45px;
    background-color: #f5f5f5;
    border-radius: 5px;
    border: none;
    color: #999999;
}
</style>